<html>
	    <head>
		       <title>js指定区域全屏</title>
		        <style>
			#fulldiv {
				background: #fff;
				width: 100%;
				text-align: center;
				height: 100%;
			}
		</style>
		<script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script>
	</head>
	    <body>
		        <h1>指定区域全屏测试</h1>
		        <button id="ck_buts">全屏按钮</button>
		        <div id="dashboard_id">
			            <h1>这里是全屏显示的内容</h1>
			        </div>
		    </body>
	    <script>
		//全屏功能
		document.getElementById("ck_buts").onclick = function() {
			var elem = document.getElementById("dashboard_id");
			//elem.style.width = "100%";
			//elem.style.height = "100%";
			//elem.style.overflowY = "scroll";
			requestFullScreen(elem); // 某个页面元素
			//requestFullScreen(document.documentElement); // 整个网页
		};


		function requestFullScreen(element) {
			// 判断各种浏览器，找到正确的方法
			var requestMethod = element.requestFullScreen || //W3C
				element.webkitRequestFullScreen || //Chrome等
				element.mozRequestFullScreen || //FireFox
				element.msRequestFullScreen; //IE11
			if (requestMethod) {
				requestMethod.call(element);
			} else if (typeof window.ActiveXObject !== "undefined") { //for Internet Explorer
				var wscript = new ActiveXObject("WScript.Shell");
				if (wscript !== null) {
					wscript.SendKeys("{F11}");
				}
			}
		}


		//退出全屏 判断浏览器种类
		function exitFull() {
			// 判断各种浏览器，找到正确的方法
			var exitMethod = document.exitFullscreen || //W3C
				document.mozCancelFullScreen || //Chrome等
				document.webkitExitFullscreen || //FireFox
				document.webkitExitFullscreen; //IE11
			if (exitMethod) {
				exitMethod.call(document);
			} else if (typeof window.ActiveXObject !== "undefined") { //for Internet Explorer
				var wscript = new ActiveXObject("WScript.Shell");
				if (wscript !== null) {
					wscript.SendKeys("{F11}");
				}
			}
		}

		//监听退出全屏事件

		window.onresize = function() {debugger;
			if (!checkFull()) {
				//要执行的动作
				document.getElementById("dashboard_id").style.background="#0000FF";
			}
		}

		function checkFull() {
			var isFull = document.webkitIsFullScreen;
			//to fix : false || undefined == undefined
			if (isFull === undefined) isFull = false;
			return isFull;
		}
	</script>
</html>
